home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 4 / Mac Giga-ROM 4.0 - 1993.toast / FILES / BBS / SECOND_SIGHT / SS:RRHVal.cpt / program.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-13  |  2.1 KB  |  135 lines  |  [TEXT/KAHL]

  1. #include <console.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <unix.h>
  5.  
  6. #define MAXPATH  128
  7.  
  8. int brthday;
  9.  
  10. char name[50];
  11. char tel_num[15];
  12. char b_day[8];
  13. char str_add[50];
  14. char cit[50];
  15. char state[50];
  16. char zip[12];
  17.  
  18. FILE *fp;
  19.  
  20. main()
  21. {
  22.     blow();
  23.     ask_user();
  24.     print_stats();
  25.     file_dump();
  26.     thanks();
  27. }
  28.  
  29. blow()
  30. {
  31.     int i;
  32.  
  33.    for(i = 0; i < 12; i++) puts(" ");
  34.    puts("         Welcome to: INFOMan!\n");
  35.    puts("                a product of Dreamer's Software!\n\n");
  36.    puts("    Written in Think C 5.0:  GLOBAL VILLAGE BBS (512)476-0016, Austin, Tx.\n");
  37.    for(i = 0; i < 12; i++) puts(" ");
  38. }
  39.  
  40. ask_user()
  41. {
  42.     
  43.     printf("\n ");
  44.     getchar();
  45.     
  46.     printf("\nHello, what is your name? ");
  47.     gets(name);
  48.     
  49.     printf("\nWhat is your telephone number? ");
  50.     gets(tel_num);
  51.     
  52.     printf("\nWhat is your birthday? ");
  53.     gets(b_day);
  54.     
  55.     printf("\nStreet address: ");
  56.     gets(str_add);
  57.     
  58.     printf("\nCity: ");
  59.     gets(cit);
  60.     
  61.     printf("\nState: ");
  62.     gets(state);
  63.     
  64.     printf("\nZip code: ");
  65.     gets(zip);
  66.     
  67. }
  68.  
  69. print_stats()
  70. {
  71.     printf("\n\nYour name is: %s\n", name);
  72.     printf("Your telephone number is: %s\n", tel_num);
  73.     printf("Your birthday is: %s\n", b_day);
  74.     printf("Your street address is: %s\n", str_add);
  75.     printf("Your city of residence is: %s\n", cit);
  76.     printf("Your state of residence is: %s\n", state);
  77.     printf("Your zip code is: %s\n", zip);
  78.     puts("\n\n");
  79.     printf("Is this information correct?(Y/N): ");
  80.     if(!user_confirmed())
  81.         {
  82.             return(main());
  83.         }
  84.     else
  85.         {
  86.         file_dump();
  87.         }
  88. }
  89.  
  90. file_dump()
  91. {
  92.     fp = fopen(":Validations:INFOMan" , "a+");
  93.     
  94.     fputs(name, fp);
  95.     fputs(tel_num, fp);
  96.     fputs(b_day, fp);
  97.     fputs(str_add, fp);
  98.     fputs(cit, fp);
  99.     fputs(state, fp);
  100.     fputs(zip, fp);
  101.     
  102.     fclose(fp);
  103.     
  104.     thanks();
  105. }
  106.  
  107. thanks()
  108. {
  109.     int i;
  110.  
  111.        for(i = 0; i < 12; i++) puts(" ");
  112.        puts("                       Thanks for using: INFOMan!");
  113.        puts("                     a product of Dreamer's Software!");
  114.        for(i = 0; i < 12; i++) puts(" ");
  115.  
  116.        exec("T.W. 105:BBS:Second Sight");
  117. }
  118.  
  119. user_confirmed()
  120.  {
  121.      while(1)
  122.          {
  123.              switch(getchar())
  124.                  {
  125.              case 'y':
  126.              case 'Y':
  127.                  return 1;
  128.              case 'n':
  129.              case 'N':
  130.                  return 0;
  131.              default:
  132.                  break;
  133.                  }
  134.          }
  135.  }